﻿/* Created by: Ben Dummler, Subodh Shrestha
 * Contact: bdummler@gmail.com, forsubodh@gmail.com */

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TravelExpertsManagementConsole
{
    public partial class Home : Form
    {
        public Home(frmContainer Parent)
        {
            InitializeComponent();

            MdiParent = Parent;
        }

        private void ordersNav_Click(object sender, EventArgs e)
        {
            frmContainer parent = (frmContainer)MdiParent;
            if (parent.childBooking == null)
            {
                parent.childBooking = new formBooking(parent);
                parent.childBooking.Show();
            }
            parent.childBooking.Focus();
        }

        private void packNav_Click(object sender, EventArgs e)
        {
            frmContainer parent = (frmContainer)MdiParent;
            if (parent.childPackage == null)
            {
                parent.childPackage = new formPackage(parent);
                parent.childPackage.Show();
            }
            parent.childPackage.Focus();
        }

        private void supplyNav_Click(object sender, EventArgs e)
        {
            frmContainer parent = (frmContainer)MdiParent;
            if (parent.childSupplier == null)
            {
                parent.childSupplier = new formSupplier(parent);
                parent.childSupplier.Show();
            }
            parent.childSupplier.Focus();
        }

        private void productsNav_Click(object sender, EventArgs e)
        {
            frmContainer parent = (frmContainer)MdiParent;
            if (parent.childProduct == null)
            {
                parent.childProduct = new formProduct(parent);
                parent.childProduct.Show();
            }
            parent.childProduct.Focus();
        }

        private void Home_FormClosing(object sender, FormClosingEventArgs e)
        {
            frmContainer parent = (frmContainer)MdiParent;

            parent.childHomePage = null;
        }

        private void signoutNav_Click(object sender, EventArgs e)
        {
            frmContainer parent = (frmContainer)MdiParent;
            parent.logout();
        }
    }
}
